import {Component, Vue} from 'vue-property-decorator'

@Component
export default class Base extends Vue {
  // 搜索
  public search: any = {
    keyword_type: '',
    keyword: ''
  }

  // 表格
  public table: any = {
    loading: false,
    loadText: 'Loading...',
    emptyText: '暂无数据',
    backgroundColor: 'rgba(0, 0, 0, .3)'
  }

  // 分页
  public pagination: any =  {
    pageSizes: [20, 40, 60, 80, 100],
    perPage: 20,
    currentPage: 1
  }

  /**
   * 初始化分页
   *
   * @return {void}
   */
  public initPagination(): void {
    this.pagination.perPage = 20
    this.pagination.currentPage = 1
  }

  // 参数
  public params: any = {}
  
  /**
   * 设置参数
   *
   * @param param
   */
  public setParam(param: any): void {
    this.params = param
  }
  
  
  // 多选
  public ids: Array<number> = []
  
  /**
   * 处理选择
   *
   * @param selection
   * @return {void}
   */
  public handleSelectionChange(selection: Array<any>): void {
    this.ids = []
    selection.forEach(item => {
      this.ids.push(item.id)
    })
    console.log(this.ids)
  }
}
